home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / propModValues.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  7.6 KB  |  282 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //
  19. //  Alias|Wavefront Script File
  20. //  MODIFY THIS AT YOUR OWN RISK
  21. //
  22. //  Creation Date:  Jan 30, 1996
  23. //  Author:         laf
  24. //
  25. //  Description:
  26. //  This proc fills the propMod tool property sheet with values.
  27. //  See also sphereProperties.mel
  28. //
  29. //  Input Arguments:
  30. //      $toolName        - this is the name of the instance of the tool
  31. //                        that the property sheet is modifying.
  32. //
  33. //  Return Value:
  34. //      None.
  35. //
  36. //
  37. //
  38. //
  39.  
  40. global proc string propModAnimCurveBuild( string $name )
  41. {
  42.     global string $gPropModAnimCurvePrefix;
  43.  
  44.     if( "" == $name ) {
  45.         $name = `createNode animCurveUU -n $gPropModAnimCurvePrefix`;
  46.         setKeyframe -f 0 -v 100 $name;
  47.         setKeyframe -f 10 -v 0 $name;
  48.     }
  49.  
  50.     return $name;
  51. }
  52.  
  53. global proc propModAnimCurveSet( string $name )
  54. {
  55.     string $curveName = propModAnimCurveBuild( $name );
  56.     propModCtx -e -ac $curveName `currentCtx`;
  57. }
  58.  
  59. global proc propModAnimCurveParamSet( string $name )
  60. {
  61.     string $curveName = propModAnimCurveBuild( $name );
  62.     propModCtx -e -acp $curveName `currentCtx`;
  63. }
  64.  
  65. global proc propModDirCheckToVec( int $which, int $state )
  66. {
  67.     string $cc = `currentCtx`;
  68.     float $dir[] = `propModCtx -q -d $cc`;
  69.     if( $state ) {
  70.         $dir[$which] = 1.0;
  71.     }
  72.     else {
  73.         $dir[$which] = 0.0;
  74.     }
  75.     propModCtx -e -d $dir[0] $dir[1] $dir[2] $cc;
  76. }
  77.  
  78. global proc propModLinearDistToSlope( float $dist )
  79. {
  80.     float $lin;
  81.     if( 0.0 == $dist ) {
  82.         $lin = 1e6;
  83.     }
  84.     else {
  85.         $lin = -1.0/$dist;
  86.     }
  87.     
  88.     propModCtx -e -l $lin `currentCtx`;
  89. }
  90.  
  91. global proc propModLinearParamCutoff( int $which, float $dist )
  92. {
  93.     // Query the existing values
  94.      string $cc = `currentCtx`;
  95.      float $distUV[] = `propModCtx -q -lp $cc`;
  96.  
  97.     // Send the correct new/existing value pair
  98.      if ( $which == 0 )
  99.      {
  100.          propModCtx -e -lp $dist  $distUV[1] `currentCtx`;
  101.      }
  102.      else
  103.      {
  104.          propModCtx -e -lp $distUV[0] $dist `currentCtx`;
  105.      }
  106. }
  107.  
  108.  
  109. global proc propModPowerCutoff( int $which, float $dist )
  110. {
  111.     // Query the existing values
  112.      string $cc = `currentCtx`;
  113.      float $distUV[] = `propModCtx -q -pcp $cc`;
  114.  
  115.     // Send the correct new/existing value pair
  116.      if ( $which == 0 )
  117.      {
  118.          propModCtx -e -pcp $dist  $distUV[1] `currentCtx`;
  119.      }
  120.      else
  121.      {
  122.          propModCtx -e -pcp $distUV[0] $dist `currentCtx`;
  123.      }
  124. }
  125.  
  126.  
  127. global proc propModNurbsCurveSet( string $name )
  128. {
  129.     propModCtx -e -nc $name `currentCtx`;
  130. }
  131.  
  132. global proc propModDimmer( int $type )
  133. {
  134.     if( 1 == $type ) {
  135.         // Linear:
  136.         tabLayout -e -selectTab propModLinearTab propModTypeTabs;
  137.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  138.     }
  139.     else if( 2 == $type ) {
  140.         // Power:
  141.         tabLayout -e -selectTab propModPowerTab propModTypeTabs;
  142.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  143.     }
  144.     else if( 3 == $type ) {
  145.         // Script:
  146.         tabLayout -e -selectTab propModScriptTab propModTypeTabs;
  147.         tabLayout -e -selectTab propModDirInvis propModDirTabs;
  148.     }
  149.     else if( 4 == $type ) {
  150.         // Anim Curve:
  151.         tabLayout -e -selectTab propModAnimTab propModTypeTabs;
  152.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  153.     }
  154.     else if( 5 == $type ) {    
  155.         tabLayout -e -selectTab propModNurbsTab propModTypeTabs;
  156.         // NURBS 
  157.         tabLayout -e -selectTab propModDirInvis propModDirTabs;
  158.     }
  159.     else if( 6 == $type ) {
  160.         // Linear: Parametric
  161.         tabLayout -e -selectTab propModLinearParamTab propModTypeTabs;
  162.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  163.     }
  164.     else if( 7 == $type ) {
  165.         // Power: Parametric
  166.         tabLayout -e -selectTab propModPowerParamTab propModTypeTabs;
  167.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  168.     }
  169.     else if( 8 == $type ) {
  170.         // Script: Parametric
  171.         tabLayout -e -selectTab propModScriptParamTab propModTypeTabs;
  172.         tabLayout -e -selectTab propModDirInvis propModDirTabs;
  173.     }
  174.     else if( 9 == $type ) {
  175.         // Anim Curve: Parametric
  176.         tabLayout -e -selectTab propModAnimParamTab propModTypeTabs;
  177.         tabLayout -e -selectTab propModDirVis propModDirTabs;
  178.     }
  179.     else if( 10 == $type ) {    
  180.         // NURBS : Parametric
  181.         tabLayout -e -selectTab propModNurbsParamTab propModTypeTabs;
  182.         tabLayout -e -selectTab propModDirInvis propModDirTabs;
  183.     }
  184. }
  185.  
  186.  
  187. global proc propModValues( string $toolName )
  188. //
  189. //  Description:
  190. //        Sets the state of the property sheet based on the values
  191. //        in the tool context.
  192. //
  193. {    
  194.     // set my top layout to be the current $parent
  195.     //
  196.     string $parent = (`toolPropertyWindow -q -location` + "|propMod");
  197.     setParent $parent;
  198.  
  199.     int $type = `propModCtx -q -t $toolName`;
  200.     float $lin = `propModCtx -q -l $toolName`;
  201.     string $script = `propModCtx -q -s $toolName`;
  202.     string $scriptUV = `propModCtx -q -sp $toolName`;
  203.     string $anim = `propModCtx -q -ac $toolName`;
  204.     string $animUV = `propModCtx -q -acp $toolName`;
  205.     float $pc = `propModCtx -q -pc $toolName`;
  206.     float $pcUV[] = `propModCtx -q -pcp $toolName`;
  207.     float $pd = `propModCtx -q -pd $toolName`;
  208.     float $pdp = `propModCtx -q -pdp $toolName`;
  209.     float $dir[] = `propModCtx -q -d $toolName`;
  210.     float $linUV[] = `propModCtx -q -lp $toolName`;
  211.     string $nurbsCurve = `propModCtx -q -nc $toolName`;
  212.     int $ws = `propModCtx -q -ws $toolName`;
  213.  
  214.     if( 0.0 == $lin ) {
  215.         $lin = 1e6;
  216.     }
  217.     else {
  218.         $lin = -1.0/$lin;
  219.     }
  220.  
  221.     floatSliderGrp -e -v $lin linearField;
  222.     floatSliderGrp -e -v $pc powerCutoff;
  223.     floatSliderGrp -e -v $pd powerDegree;
  224.     textField -e -text $anim animCurveName;
  225.     textField -e -text $animUV animCurveNameParam;
  226.     textFieldGrp -e -text $script scriptName;
  227.     textFieldGrp -e -text $scriptUV scriptNameParam;
  228.     textField -e -text $nurbsCurve nurbsCurveName;
  229.     floatSliderGrp -e -v $linUV[0] linearFieldU;
  230.     floatSliderGrp -e -v $linUV[1] linearFieldV;
  231.     floatSliderGrp -e -v $pdp powerDegreeParam;
  232.     floatSliderGrp -e -v $pcUV[0] powerCutoffU;
  233.     floatSliderGrp -e -v $pcUV[1] powerCutoffV;
  234.  
  235.  
  236.     int $buttonType;
  237.     if ( $ws == 1 )
  238.     {
  239.         // Working in world space
  240.         radioButtonGrp -e -sl 1 modSpace;
  241.         radioButtonGrp -e -vis on modType3;    // Ensure the NURBS option is available
  242.         $buttonType = $type;
  243.     }
  244.     else
  245.     {
  246.         // Working in parametric space
  247.         radioButtonGrp -e -sl 2 modSpace;
  248.         radioButtonGrp -e -vis off modType3;  // Ensure the NURBS option is NOT available
  249.         $buttonType = $type - 5;
  250.     }
  251.  
  252.     switch( $buttonType ) 
  253.     {
  254.         case 1:
  255.             radioButtonGrp -e -sl 1 modType;
  256.             break;
  257.         case 2:
  258.             radioButtonGrp -e -sl 2 modType;
  259.             break;
  260.         case 3:
  261.             radioButtonGrp -e -sl 1 modType2;
  262.             break;
  263.         case 4:
  264.             radioButtonGrp -e -sl 2 modType2;
  265.             break;
  266.         case 5:
  267.             radioButtonGrp -e -sl 1 modType3;
  268.             break;
  269.     } 
  270.  
  271.     checkBoxGrp -e -v1 (0.0 != $dir[0]) modDir;
  272.     checkBoxGrp -e -v2 (0.0 != $dir[1]) modDir;
  273.     checkBoxGrp -e -v3 (0.0 != $dir[2]) modDir;
  274.     propModDimmer $type;
  275.     
  276.     // set property sheet label and icon
  277.     //
  278.     string $helpTag = "ProportionalModificationTool";
  279.     toolPropertySetCommon $toolName "propMod.xpm" $helpTag;
  280.     toolPropertySelect propMod;
  281. }
  282.